﻿
#ifndef EffectParameterCollection_h
#define EffectParameterCollection_h

#include <System/Collections/Generic/List.h>
#include <System/Collections/Generic/IEnumerable.h>
#include <System/Array.h>
#include <System/ArgumentNullException.h>

#include "../Effect/EffectParameter.h"
#include "../Effect/EffectParameterClass.h"
#include "../Effect/EffectParameterType.h"


namespace Riccsson
{
	namespace Xna
	{
		namespace Framework
		{
			namespace Graphics
			{
				class EffectParameterCollection
					: public Riccsson::System::Collections::Generic::IEnumerable<GC_PTR<EffectParameter>>
                {
					using Riccsson::System::Collections::Generic::IEnumerable<GC_PTR<EffectParameter>>::begin;
					using Riccsson::System::Collections::Generic::IEnumerable<GC_PTR<EffectParameter>>::end;

                    PROP3(EffectParameterCollection, int, Count)

                    private: GC_PTR<Riccsson::System::Collections::Generic::List<GC_PTR<EffectParameter>>> _parameters;
						
					COPY_CONSTRUCTOR(EffectParameterCollection)
					{
						PROP3_INIT_COPY(EffectParameterCollection, int, Count);
					}

                    public: /*internal*/ EffectParameterCollection()
					    : PROP3_INIT(EffectParameterCollection, Count)
						, _parameters( new Riccsson::System::Collections::Generic::List<GC_PTR<EffectParameter>>() )
                    {
                    }

                    public: /*internal*/ EffectParameterCollection(GC_PTR<EffectParameterCollection> cloneSource)
					    : PROP3_INIT(EffectParameterCollection, Count)
						, _parameters( new Riccsson::System::Collections::Generic::List<GC_PTR<EffectParameter>>() )
                    {
                        //foreach (var parameter : *cloneSource.get())
                        //    Add(new EffectParameter(parameter));
						throw;
                    }

                    public: PROP3_GET(int, Count)
                    {
                        return _parameters->Count;
                    }
		            private: PROP3_SET(int, Count){throw;}

		            public: GC_PTR<EffectParameter> operator[](int index)
		            {
			            return _parameters->at(index);
		            }
		
				    public: GC_PTR<EffectParameter> operator[](Riccsson::System::string* name)
                    {
                        //// TODO: Add a name to parameter lookup table.
				        //foreach (var parameter : *_parameters.get()) 
                        //{
					    //    if (parameter != null && parameter->Name == name) 
						//        return parameter;
				        //}
						//
				        //return null;
						throw;
                    }

                    public: Riccsson::System::Collections::Generic::IEnumerator<GC_PTR<EffectParameter>>* GetEnumerator()
                    {
                        return _parameters->GetEnumerator();
                    }

                    //System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
                    //{
                    //    return _parameters.GetEnumerator();
                    //}

                    public: /*internal*/ void Add(GC_PTR<EffectParameter> param)
                    {
                        _parameters->Add(param);
                    }
                };
            }
		}
	}
}

#endif